package com.juelunn.unit;


public class Grade {


    //数据区间起点，数据终点，等级
    private int Start;
    private int End;
    private int level;

    Grade(int Start, int End, int level) {
        this.Start = Start;
        this.End = End;
        this.level = level;
    }
    public static Grade fromDate(int grade) {
        if (grade>=0&&grade<50){
            return new Grade(0,50,7);
        }else if (grade>=50&&grade<200){
            return new Grade(50,200,6);
        }else if (grade>=200&&grade<500){
            return new Grade(200,500,5);
        } else if (grade>=500&&grade<800){
            return new Grade(500,800,4);
        }else if (grade>=800&&grade<1300){
            return new Grade(800,1300,3);
        }else if (grade>=1300&&grade<2000){
            return new Grade(1300,2000,2);
        }else if (grade>=2000){
            return new Grade(2000,Integer.MAX_VALUE,1);
        }
        return null;
    }
    @Override
    public String toString() {
        return "[" + this.Start+"-"+this.End + "] ,对应的疫情级别是"  + this.level;
    }

    public int getLevel() {
        return level;
    }
}
